#include <iostream>
#include <cstdio>
using namespace std;

int main(){
	int n,maxs=-1,mins=1005,x;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		if(x>maxs) maxs=x;
		if(x<mins) mins=x;
	} 
	cout<<maxs-mins;
	return 0;
}
